10 DEFDBL A-Z:DEFINT C,I,J:S=0:C=0:DIM D(2048)
15 INPUT "Load from file? (Y/N)",F$:IF F$="y" OR F$="Y" THEN GOTO 200
20 PRINT "Input Numbers (Input 'x' to end):":WHILE C<2048:INPUT "> ",S$
30 IF S$="" THEN PRINT "Empty Input":GOTO 69 ELSE IF S$="x" THEN GOTO 70
40 V=VAL(S$):D(C)=V:S=S+V:C=C+1
50 IF C=1 THEN MIN=V:MAX=V ELSE IF V<MIN THEN MIN=V ELSE IF V>MAX THEN MAX=V
69 WEND
70 IF C<2 THEN PRINT "Minimum 2 numbers required":END
80 INPUT "Save to file? (Y/N)",F$:IF F$="y" OR F$="Y" THEN GOSUB 300
100 PRINT "CNT";C:PRINT "SUM";S:PRINT "AVG";S/C:PRINT "MIN";MIN:PRINT "MAX";MAX
110 A=S/C:VAR=0:FOR I=0 TO C-1:VAR=VAR+(D(I)-A)^2:NEXT I
120 IF C>1 THEN PRINT "STDDEV";SQR(VAR/C):PRINT "STDDEV2";SQR(VAR/(C-1))
130 FOR I=C-1 TO 0 STEP -1:FOR J=0 TO I-1
140 IF D(J)>D(J+1) THEN T=D(J):D(J)=D(J+1):D(J+1)=T
150 NEXT J:NEXT I
160 PRINT "MID";
170 IF C AND 1 THEN PRINT D(C\2) ELSE PRINT (D(C\2-1)+D(C\2))/2
180 END
200 INPUT "Filename:",F$:OPEN F$ FOR INPUT AS #1
210 WHILE NOT EOF(1):INPUT #1,S$:IF S$="" THEN GOTO 250
220 V=VAL(S$):D(C)=V:S=S+V:C=C+1
230 IF C=1 THEN MIN=V:MAX=V ELSE IF V<MIN THEN MIN=V ELSE IF V>MAX THEN MAX=V
240 WEND
250 CLOSE #1:IF C<2 THEN PRINT "Minimum 2 numbers required":END ELSE GOTO 100
300 INPUT "Filename:",F$:OPEN F$ FOR OUTPUT AS #1
310 FOR I=0 TO C-1:PRINT#1,D(I):NEXT I:CLOSE #1:RETURN

